home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-18 | 2.0 KB | 59 lines | [TEXT/MMCC] |
- /**********************************************************************
- CRawText.cp
-
- A Pane containing a text string
-
- This is a text string that can be left justified, center justified,
- or right justified. For now, we can just set it LEFT justified.
-
- The pane's size will be changed depending on the text size. For
- instance, when the text is LEFT justified, the RIGHT side of the
- pane will move out (or in) to just fit the text to be displayed.
-
- **********************************************************************/
-
- #include "NeoTypes.h"
- #include "LView.h"
- #include "CRawText.h"
- #include "NeoBench.h"
- #include <time.h>
- #include <stdio.h>
-
- /**********************************************************************
-
- **********************************************************************/
- CRawText::CRawText(LView *aSuperView, ConstStr255Param aText, const short aX, const short aY, const short aWidth, const short aHeight)
- : LCaption()
- {
- PutInside(aSuperView);
- SetDescriptor(aText);
- ResizeFrameTo(aWidth, aHeight, FALSE);
- PlaceInSuperImageAt(aX, aY, FALSE);
- }
-
- /**********************************************************************
-
- **********************************************************************/
- CTimeText::CTimeText(LView *aSuperView, ConstStr255Param aText, const short aX, const short aY, const short aWidth, const short aHeight)
- : CRawText(aSuperView, aText, aX, aY, aWidth, aHeight)
- {
- }
-
- /*********************************************************************
- aValue is microseconds of time.
-
- *********************************************************************/
- void CTimeText::SetValue(Int32 aValue)
- {
- Str255 string;
-
- unsigned long value = (unsigned long)aValue;
- unsigned long thous = ((value % 1000000) / 100); // get thousandths of seconds
- unsigned long secs = ((value / 1000000) % 60); // get seconds
- unsigned long mins = (value / (1000000 * 60)); // get minutes
-
- sprintf((char *)&string[1], "%2.0lu:%2.2lu.%4.4lu", mins, secs, thous);
- string[0] = 11;
- SetDescriptor(string);
- }
-